FormSuite for Invoices 1 for .Net - User Guide > How To > Perform Advanced Operations > Add / Remove Pages |
Sometimes invoice processing will add pages to an invoice which do not belong to that invoice, or splits a single multi-page invoice into multiple invoices. When this occurs the pages can be added or removed from one invoice to another. This is accomplished with the InsertPage and RemovePage methods of the FormResult class.
Example - An example of adding and removing pages |
Copy Code |
---|---|
// Add a page from form2 to the end of form2 form1.InsertPage(form2.Document[pageIndexToMove], form1.Document.Count); // Remove the page from form 2 form2.RemovePage(pageIndexToMove); |
Example - Removing a Document page from one FormResult and creating a new FormResult |
Copy Code |
---|---|
// Create list of pages to add to the new form result List<DocumentPage> pagesToAdd = new List<DocumentPage>(); pagesToAdd.Add(form1.Document[pageIndexToMove]); // Create a new form result with the page form form1 FormResult formResult = new FormResult(pagesToAdd, formDefinition); // Remove the page from form1 form1.RemovePage(pageIndexToMove); |
The Fields and Tables of the FormResult are recalculated after each InsertPage and RemovePage operation.
Add and Remove operations should be performed in paired operations so pages are not duplicated between FormResult. |